/*导航js--------------------------------------------------------------------zz*/
jQuery(function(){
  	jQuery('.first.dropdown').hover(function() {
		jQuery(this).children(".dropdown-menu").css('display', 'block');
	}, function() {
		jQuery(this).children(".dropdown-menu").css('display', 'none');
	});
    jQuery('.own_zz .dropdown-submenu .dropdown-menu').css('display', 'none');
		jQuery('.own_zz .dropdown-toggle').click(function(event) {
			jQuery('.own_zz').toggleClass('open');
		});
			jQuery('.own_zz .dropdown-submenu-link').click(function(event) {
				jQuery(this).parent().children('.dropdown-menu').toggle(200);
				jQuery(this).parent().siblings().children('.dropdown-menu').hide(200);
			});

});
jQuery('.dropdown-submenu').click(function(){
    if(jQuery(this).find(".dropdown-menu").css('display')=='none'){
        jQuery(this).find('.dropdown-menu').slideDown(200);
        jQuery(this).find(".dwon").css('display','none');
        jQuery(this).find(".top").css('display','block');
    }else{
        jQuery(this).find('.dropdown-menu').slideUp(200);
        jQuery(this).find(".dwon").css('display','block');
        jQuery(this).find(".top").css('display','none');
    }
});
/*导航js结束-----------------------------------------------------------------------------------------------------zz*/
jQuery('.main-banner-wrap').owlCarousel({
	navigation : true,
	navigationText:['<span class="glyphicon glyphicon-chevron-left"></span>','<span class="glyphicon glyphicon-chevron-right"></span>'],
	slideSpeed : 300,
	paginationSpeed : 800,
	singleItem:true,
	lazyLoad : true,
	autoPlay : 5000,
	stopOnHover : true,
	lazyFollow: false,
	pagination: true
});

jQuery('.partners-wrap').owlCarousel({
	items:4,
	// itemsDesktop:[1600,5],


	itemsDesktopSmall: [1200,3],
	itemsTablet: [768,2],
	itemsMobile: [479,1],
	loop:true,
	navigation:true,
	navigationText:['<span class="glyphicon glyphicon-chevron-left"></span>','<span class="glyphicon glyphicon-chevron-right"></span>'],
	pagination: false,
	paginationNumbers: false,
	nav: false,
	dots: false,
	autoWidth: true,
	lazyLoad : true,
	autoPlay : 5000,
	stopOnHover : true

});

jQuery('.news-wrap').owlCarousel({
	items:4,
	// itemsDesktop:[1600,5],
	itemsDesktopSmall: [1200,3],
	itemsTablet: [968,2],
	itemsMobile: [479,1],
	loop:true,
	navigation:true,
	navigationText:['<span class="glyphicon glyphicon-chevron-left"></span>','<span class="glyphicon glyphicon-chevron-right"></span>'],
	pagination: false,
	paginationNumbers: false,
	nav: false,
	dots: false,
	autoWidth: true,
	lazyLoad : true,
	autoPlay : 5000,
	stopOnHover : true

});

jQuery('.main-items-wrap').owlCarousel({
	items:4,
	// itemsDesktop:[1600,5],


	itemsDesktopSmall: [1200,3],
	itemsTablet: [768,2],
	itemsMobile: [479,1],
	loop:true,
	navigation:true,
	navigationText:['<span class="glyphicon glyphicon-chevron-left"></span>','<span class="glyphicon glyphicon-chevron-right"></span>'],
	pagination: false,
	paginationNumbers: false,
	nav: false,
	dots: false,
	autoWidth: true,
	lazyLoad : true,
	autoPlay : 5000,
	stopOnHover : true
});


jQuery('.cat-banner-group').owlCarousel({
	items:4,
	// itemsDesktop:[1600,5],


	itemsDesktopSmall: [1200,3],
	itemsTablet: [968,2],
	itemsMobile: [479,1],
	loop:true,
	navigation:true,
	navigationText:['<span class="glyphicon glyphicon-chevron-left"></span>','<span class="glyphicon glyphicon-chevron-right"></span>'],
	pagination: false,
	paginationNumbers: false,
	nav: false,
	dots: false,
	autoWidth: true,
	lazyLoad : true,
	autoPlay : 5000,
	stopOnHover : true

});

jQuery('.cat-banner-group-3').owlCarousel({
	items:3,
	// itemsDesktop:[1600,5],
	itemsDesktopSmall: [1200,2],
	itemsTablet: [968,2],
	itemsMobile: [479,1],
	loop:true,
	navigation:true,
	navigationText:['<span class="glyphicon glyphicon-chevron-left"></span>','<span class="glyphicon glyphicon-chevron-right"></span>'],
	pagination: false,
	paginationNumbers: false,
	nav: false,
	dots: false,
	autoWidth: true,
	lazyLoad : true,
	autoPlay : 5000,
	stopOnHover : true
});


	jQuery('.main-sales-wrap').owlCarousel({
       items:3,
	  // itemsDesktop:[1600,5],
	 itemsDesktopSmall: [1200,3],
	   itemsTablet: [968,2],
		itemsMobile: [479,1],
        loop:true,
		navigation:true,
		navigationText:['<span class="glyphicon glyphicon-chevron-left"></span>','<span class="glyphicon glyphicon-chevron-right"></span>'],
		pagination: false,
		paginationNumbers: false,
		nav: false,
        dots: false,
		autoWidth: true,
		lazyLoad : true,
		autoPlay : 5000,
		stopOnHover : true
    });
	
	jQuery('.cat-banner-single-wrap').owlCarousel({
		navigation : true,
		navigationText:['<span class="glyphicon glyphicon-chevron-left"></span>','<span class="glyphicon glyphicon-chevron-right"></span>'],
		slideSpeed : 300,
		paginationSpeed : 800,
		singleItem:true,
		lazyLoad : true,
		autoPlay : 5000,
		stopOnHover : true,
		lazyFollow: false,
		pagination: true
	});
	
	//toggle for FAQ
	jQuery(".opening").click(function(){
		jQuery(this).next('.unvisible').toggle(150);
		jQuery(this).toggleClass('open');
		jQuery(this).find('span').toggleClass("glyphicon-chevron-down glyphicon-chevron-up");
	});
	



//modal links
	jQuery('.modal-link').click(function(){
		jQuery('#modal-small .modal-content').load(jQuery(this).attr('href'));	
	});
	jQuery('.modal-large-link').click(function(){
		jQuery('#modal-large .modal-content').load(jQuery(this).attr('href'));	
	});


jQuery(".item-annotation-pult").click(function(){
	jQuery(this).next('.item-annotation-wrap').toggle(150);
	jQuery(this).toggleClass('open');
	//jQuery(this).find('span').toggleClass("glyphicon-chevron-down glyphicon-chevron-up");


	return false;
});



jQuery('.nav-tabs a').click(function (e) {
	e.preventDefault();
	jQuery(this).tab('show');
});

jQuery('.nav-tabs a').on('show.bs.tab', function (e) {
	jQuery('.nav-tabs a').each(function(){
		jQuery(this).show();
	});
});




var toTopArrow =  jQuery('.to-top-arrow');

jQuery(window).scroll(function () {
	if (jQuery(this).scrollTop() > 50) {
		toTopArrow.fadeIn();
	} else {
		toTopArrow.fadeOut();
	}
});

toTopArrow.click(function(){
	jQuery('body,html').animate({scrollTop: 0}, 400);
});
//костыли-костылюшки, для менюшки-менюшеньки


jQuery('.linkblock a').each(function(){
	thisHref = jQuery(this).attr('href');
	if(thisHref == location.pathname){
		jQuery(this).addClass('active');
	}
});
jQuery('.bottom-menu a').each(function(){
	thisHref = jQuery(this).attr('href');
	if(thisHref == location.pathname){
		jQuery(this).addClass('active');
	}
});
jQuery('.nav.navbar-nav a').each(function(){
	thisHref = jQuery(this).attr('href');
	if(thisHref == location.pathname){
		jQuery(this).parent('li').addClass('active');
	}
});


//expo popup window by ip-address
/*jQuery.get("https://ipinfo.io", function(response) { ///212.113.253.0/json /46.216.57.103/json  /91.143.16.2/json
		console.log(response.city, response.region, response.country);
		if(response.city == "Yekaterinburg" || response.region == "Sverdlovskaya Oblast'"){
			if(!jQuery.cookie('regionalShow')){
				jQuery('#regional-modal').find('.modal-content').html('<div class="modal-header"><button type="button" class="close" data-dismiss="modal" aria-hidden="true">×</button><h4>Оптовый выставочный центр обуви в Вашем регионе!</h4></div><div class="modal-body"><a href="http://expo.qifa.ru?utm_source=qifa_popup_banner&utm_medium=regional&utm_campaign=ekb" target="_blank"><img src="/themes/qifa/img/popup/ekb-popup.jpg" alt="" title="" style="width: 100%;" /></a></div>');
				jQuery('#regional-modal').modal({backdrop:'static', show:'show'});
					jQuery.cookie('regionalShow', true);
			}
		}
		if(response.city == "Pyatigorsk" || response.region == "Stavropol'skiy Kray" || response.region == "Stavropol'"){
			if(!jQuery.cookie('regionalShow')){
				jQuery('#regional-modal').find('.modal-content').html('<div class="modal-header"><button type="button" class="close" data-dismiss="modal" aria-hidden="true">×</button><h4>Оптовый выставочный центр обуви в Вашем регионе!</h4></div><div class="modal-body"><a href="http://expo.qifa.ru?utm_source=qifa_popup_banner&utm_medium=regional&utm_campaign=pyatigorsk" target="_blank"><img src="/themes/qifa/img/popup/pyatigorsk-popup.jpg" alt="" title="" style="width: 100%;" /></a></div>');
				jQuery('#regional-modal').modal({backdrop:'static', show:'show'});
					jQuery.cookie('regionalShow', true);
			}
		}
		if(response.country == "BY"){
			if(!jQuery.cookie('regionalShow')){
				jQuery('#regional-modal').find('.modal-content').html('<div class="modal-header"><button type="button" class="close" data-dismiss="modal" aria-hidden="true">×</button><h4>Оптовый выставочный центр обуви в Беларуси!</h4></div><div class="modal-body"><a href="http://qifa.by?utm_source=qifa_popup_banner&utm_medium=regional&utm_campaign=belarus" target="_blank"><img src="/themes/qifa/img/popup/minsk-popup.jpg" alt="" title="" style="width: 100%;" /></a></div>');
				jQuery('#regional-modal').modal({backdrop:'static', show:'show'});
					jQuery.cookie('regionalShow', true);
			}
		}
	}, "jsonp")*/


//for menu third lvl

/*影响菜单注释掉了----------------------------------------------------------------------zz*/
/*jQuery('a.dropdown-submenu-link').click(function(){
	if(jQuery(this).next('.dropdown-menu').css('display') != 'block'){
		jQuery('a.dropdown-submenu-link').each(function(){
			//jQuery(this).parent('').remove('active');


			jQuery(this).next('.dropdown-menu').hide(1);
		});
	}
	//jQuery(this).parent('').toggleClass('active');


	jQuery(this).next('.dropdown-menu').toggle(1);
	return false;
});*/

//hide empty rows in compare

jQuery('.package-row').each(function(){
	var tds = jQuery(this).children("td:nth-child(2),td:nth-child(3),td:nth-child(4),td:nth-child(5),td:nth-child(6)");
	switch (tds.length) {
		case 1:
			if(tds.eq(0).html() == '-'){
				jQuery(this).detach();
			}
			break
		case 2:
			if(tds.eq(0).html() == '-' && tds.eq(1).html() == '-'){
				jQuery(this).detach();
			}
			break
		case 3:
			if(tds.eq(0).html() == '-' && tds.eq(1).html() == '-' && tds.eq(2).html() == '-'){
				jQuery(this).detach();
			}
			break
		case 4:
			if(tds.eq(0).html() == '-' && tds.eq(1).html() == '-' && tds.eq(2).html() == '-' && tds.eq(3).html() == '-'){
				jQuery(this).detach();
			}
			break
		case 5:
			if(tds.eq(0).html() == '-' && tds.eq(1).html() == '-' && tds.eq(2).html() == '-' && tds.eq(3).html() == '-' && tds.eq(4).html() == '-'){
				jQuery(this).detach();
			}
			break
	}
});
jQuery("#feedback button").click(function(){
	yaCounter38355260.reachGoal('call-click');
});
jQuery("#signup button").click(function(){
	yaCounter38355260.reachGoal('reg-click');
});

//e-Commerce
window.dataLayer = window.dataLayer || []; //init

//cookie parce
/*function get_cookie ( cookie_name ){
	var results = document.cookie.match ( '(^|;) ?' + cookie_name + '=([^;]*)(;|$)' );
	if ( results ) return ( unescape ( results[2] ) );
	else return null;
}
	
	var userID = get_cookie('_ym_uid');  //id */

	jQuery('body').on('click', '.gallery-grid .action-addtocart', function(){ //this is for GRID add btn
		name = jQuery.trim(jQuery(this).parents('.add-item').find('.item-title').text());
		brand = jQuery.trim(jQuery(this).parents('.add-item').find('.trademark_box').text());
		vendorCode = jQuery.trim(jQuery(this).parents('.add-item').find('.item-vendor-code b').text());
		pricePerBox = parseInt(jQuery(this).parents('.add-item').find('.item-price-per-box').data('price'), 10);
		quantity = parseInt(jQuery(this).parents('.add-item').find('.action-quantity-input').val(), 10);
		
		name = name+" "+vendorCode;
		
		dataLayer.push({
			"ecommerce": {
				"add": {
					"products": [
						{
							"id": vendorCode,
							"name": name,
							"price": pricePerBox,
							"brand": brand,
							"quantity": quantity,
							"category": "Обувь"
						}
					]
				}
			}
		});
		
		  ga('ec:addProduct', {
			'id': vendorCode,
			'name': name,
			'category': "Обувь",
			'brand': brand,
			'price': pricePerBox,
			'quantity': quantity
		  });
		  ga('ec:setAction', 'add');
		  ga('send', 'event', 'AddToCard', 'click');
	});
	
	jQuery('body').on('click', '.gallery-list .action-addtocart', function(){ //this is for LIST add btn
		name = jQuery.trim(jQuery(this).parents('.item-line').find('.item-title').text());
		brand = jQuery.trim(jQuery(this).parents('.item-line').find('.item-brand b').text());
		vendorCode = jQuery.trim(jQuery(this).parents('.item-line').find('.item-vendor-code b').text());
		pricePerBox = parseInt(jQuery(this).parents('.item-line').find('.item-price-per-box').data('price'), 10);
		quantity = parseInt(jQuery(this).parents('.item-line').find('.action-quantity-input').val(), 10);
		
		name = name+" "+vendorCode;

		dataLayer.push({
			"ecommerce": {
				"add": {
					"products": [
						{
							"id": vendorCode,
							"name": name,
							"price": pricePerBox,
							"brand": brand,
							"quantity": quantity,
							"category": "Обувь"
						}
					]
				}
			}
		});
		
		ga('ec:addProduct', {
			'id': vendorCode,
			'name': name,
			'category': "Обувь",
			'brand': brand,
			'price': pricePerBox,
			'quantity': quantity
		  });
		  ga('ec:setAction', 'add');
		  ga('send', 'event', 'AddToCard', 'click');
	});
	
	
	jQuery('body').on('click', '#product_container .action-addtocart', function(){ //this is for DETAIL add btn
		productContainer = jQuery("#product_container");
		name = jQuery.trim(productContainer.find('h1').text());
		brand = jQuery.trim(productContainer.find('.item-brand b').text());
		vendorCode = jQuery.trim(productContainer.find('.item-vendor-code b').text());
		pricePerBox = parseInt(productContainer.find('.item-price-per-box').data('price'), 10);
		quantity = parseInt(productContainer.find('.action-quantity-input').val(), 10);
		
		name = name+" "+vendorCode;

		dataLayer.push({
			"ecommerce": {
				"add": {
					"products": [
						{
							"id": vendorCode,
							"name": name,
							"price": pricePerBox,
							"brand": brand,
							"quantity": quantity,
							"category": "Обувь"
						}
					]
				}
			}
		});
		
		ga('ec:addProduct', {
			'id': vendorCode,
			'name': name,
			'category': "Обувь",
			'brand': brand,
			'price': pricePerBox,
			'quantity': quantity
		  });
		  ga('ec:setAction', 'add');
		  ga('send', 'event', 'AddToCard', 'click');
	});
	
	if(jQuery("div").is("#product_container")){ //Detail page show
		productContainer = jQuery("#product_container");
		name = jQuery.trim(productContainer.find('h1').text());
		brand = jQuery.trim(productContainer.find('.item-brand b').text());
		vendorCode = jQuery.trim(productContainer.find('.item-vendor-code b').text());
		pricePerBox = parseInt(productContainer.find('.item-price-per-box').data('price'), 10);
		
		name = name+" "+vendorCode;

		dataLayer.push({
				"ecommerce": {
					"detail": {
						"products": [
							{
								"id": vendorCode,
								"name" : name,
								"price": pricePerBox,
								"brand": brand,
								"category": "Обувь"
							}
						]
					}
				}
			});
			
			ga('ec:addImpression', {            // объект - impressionFieldObject
			  'id': vendorCode,                   // ID товара (string). Обязательный!
			  'name': name, // Название товара (string). Обязательный!
			  'category': "Обувь",   // Категория товара (string).
			  'brand': brand               // Бренд (string). 
			});
			ga('ec:setAction', 'detail');
			ga('send', 'event', 'wasViewed', { nonInteraction: true })
	}
//CART
	jQuery('#cart_main').on('click', '.btn-increase', function(){ //cart increase count
			productContainer = jQuery(this).parents("tr");
		
			name = jQuery.trim(productContainer.find('.p-title a').text());
			vendorCode = jQuery.trim(productContainer.find('.item-vendor-code').text());
			pricePerBox = parseInt(productContainer.find('.item-price').text(), 10);
			
			name = name+" "+vendorCode;

			dataLayer.push({
				"ecommerce": {
					"add": {
						"products": [
							{
								"id": vendorCode,
								"name": name,
								"price": pricePerBox,
								"quantity": 1,
								"category": "Обувь"
							}
						]
					}
				}
			});
			
		ga('ec:addProduct', {
			'id': vendorCode,
			'name': name,
			'category': "Обувь",
			'brand': brand,
			'price': pricePerBox,
			'quantity': 1
		  });
		  ga('ec:setAction', 'add');
		  ga('send', 'event', 'AddToCard', 'click');
	});
	
	jQuery('#cart_main').on('click', '.btn-decrease', function(){ //cart decrease count
			productContainer = jQuery(this).parents("tr");
		
			name = jQuery.trim(productContainer.find('.p-title a').text());
			vendorCode = jQuery.trim(productContainer.find('.item-vendor-code').text());
			pricePerBox = parseInt(productContainer.find('.item-price').text(), 10);
			
			name = name+" "+vendorCode;
			
			dataLayer.push({
				"ecommerce": {
					"remove": {
						"products": [
							{
								"id": vendorCode,
								"name": name,
								"quantity": 1,
								"category": "Обувь"
							}
						]
					}
				}
			});
			
		ga('ec:addProduct', {
			'id': vendorCode,
			'name': name,
			'category': "Обувь",
			'brand': brand,
			'price': pricePerBox,
			'quantity': 1
		  });
		  ga('ec:setAction', 'remove');
		  ga('send', 'event', 'RemoveFromCard', 'click');
	});
	
	jQuery('#cart_main').on('change', 'input[name^="modify_quantity"]', function(){ //cart change count with input 
		productContainer = jQuery(this).parents("tr");
		name = jQuery.trim(productContainer.find('.p-title a').text());
		vendorCode = jQuery.trim(productContainer.find('.item-vendor-code').text());
		pricePerBox = parseInt(productContainer.find('.item-price').text(), 10);
		quantity = jQuery(this).val();
		
		name = name+" "+vendorCode;
			
			dataLayer.push({ //on change - remove all old
				"ecommerce": {
					"remove": {
						"products": [
							{
								"id": vendorCode,
								"name": name,
								"category": "Обувь"
							}
						]
					}
				}
			});
		ga('ec:addProduct', {
			'id': vendorCode,
			'name': name,
			'category': "Обувь"
		  });
		  ga('ec:setAction', 'add');

			
			dataLayer.push({ //and add again
				"ecommerce": {
					"add": {
						"products": [
							{
								"id": vendorCode,
								"name": name,
								"price": pricePerBox,
								"quantity": quantity,
								"category": "Обувь"
							}
						]
					}
				}
			});
			
		ga('ec:addProduct', {
			'id': vendorCode,
			'name': name,
			'category': "Обувь",
			'price': pricePerBox,
			'quantity': quantity
		  });
		  ga('ec:setAction', 'add');
		  ga('send', 'event', 'AddToCard', 'click');
	});
	
	jQuery('#cart_main').on('click', '.btn-delete', function(){ //remove item btn
		productContainer = jQuery(this).parents("tr");	
		name = jQuery.trim(productContainer.find('.p-title a').text());
		vendorCode = jQuery.trim(productContainer.find('.item-vendor-code').text());
		name = name+" "+vendorCode;
	
		jQuery('body').on('click', '.action-confirm', function(){
			dataLayer.push({
				"ecommerce": {
					"remove": {
						"products": [
							{
								"id": vendorCode,
								"name": name,
								"category": "Обувь"
							}
						]
					}
				}
			});
			ga('ec:addProduct', {
				'id': vendorCode,
				'name': name,
				'category': "Обувь"
			  });
			  ga('ec:setAction', 'remove');
			  ga('send', 'event', 'RemoveFromCard', 'click');
		});	
			
	});
	

	jQuery('#cart_main').on('click', '.action-clean', function(){ //remove all items with cart
		
		products = new Array();
		jQuery(".cart-product").each(function(){
			productsInner = new Object();
			
			name = jQuery.trim(jQuery(this).find('.p-title a').text());
			vendorCode = jQuery.trim(jQuery(this).find('.item-vendor-code').text());
			name = name+" "+vendorCode;
			
			productsInner = {
				"id": vendorCode,
				"name": name,
				"category": "Обувь"
			}
			products[products.length] = productsInner;

		});

		setTimeout(function(){	
			jQuery(".alert-content .action-confirm").click(function(){
				dataLayer.push({
					"ecommerce": {
						"remove": {
							"products": products
						}
					}
				});
				
				ga('ec:addProduct', products);
				  ga('ec:setAction', 'remove');
				  ga('send', 'event', 'RemoveFromCard', 'click');
			});
		},300);
	
	
	});
	// e-commerce submit in public/app/site/statics/js_mini/ui.min.js
//e-Commerce END

//leftfilter
jQuery('.filter-entries').last().find('dt').css('border-bottom','1px solid #fff');
jQuery(".filter-entries").hover(function(){
    jQuery(this).prev().find('dt').css('border-bottom','1px solid #fff');
    jQuery(this).find('dt').css('border-bottom','1px solid #fff');
	jQuery(this).addClass('showder');
	if(jQuery(this).hasClass('open')){
		jQuery(this).toggleClass('open');
	}
	else{
		jQuery(".filter-entries").each(function(){
			jQuery(this).removeClass('open');
		});
		jQuery(this).addClass('open');
	}
},
		function(){
            jQuery(this).prev().find('dt').css('border-bottom','1px solid #cecece');
            jQuery(this).find('dt').css('border-bottom','1px solid #cecece');
            jQuery('.filter-entries').last().find('dt').css('border-bottom','1px solid #fff');
			jQuery(this).removeClass('open');
			jQuery(this).removeClass('showder');
		}
);

jQuery(document).mouseup(function (e){ //for click not in menu filter el's
	if (!jQuery(".filter-entries").is(e.target)) { //if click not this or this child blocks
		jQuery(".filter-entries").each(function(){
			jQuery(this).removeClass('open');
		});
	}
});

	jQuery(window).load(function() {
		jQuery('#rr-slider').owlCarousel({
			items:5,
			itemsDesktopSmall: [1100,3],
			itemsTablet: [968,3],
			itemsMobile: [479,1],
			loop:true,
			navigation:true,
			navigationText:['<span class="glyphicon glyphicon-chevron-left"></span>','<span class="glyphicon glyphicon-chevron-right"></span>'],
			pagination: false,
			paginationNumbers: false,
			nav: false,
			dots: false,
			autoWidth: true,
			lazyLoad : true,
			autoPlay : 5000,
			stopOnHover : true
		});
		jQuery('#rr-slider-detail').owlCarousel({
			items:4,
			itemsDesktopSmall: [1100,2],
			itemsTablet: [968,2],
			itemsMobile: [479,1],
			loop:true,
			navigation:true,
			navigationText:['<span class="glyphicon glyphicon-chevron-left"></span>','<span class="glyphicon glyphicon-chevron-right"></span>'],
			pagination: false,
			paginationNumbers: false,
			nav: false,
			dots: false,
			autoWidth: true,
			lazyLoad : true,
			autoPlay : 5000,
			stopOnHover : true
		});
		jQuery('#rr-slider-6').owlCarousel({
			items:6,
			itemsDesktopSmall: [1100,4],
			itemsTablet: [968,3],
			itemsMobile: [479,2],
			loop:true,
			navigation:true,
			navigationText:['<span class="glyphicon glyphicon-chevron-left"></span>','<span class="glyphicon glyphicon-chevron-right"></span>'],
			pagination: false,
			paginationNumbers: false,
			nav: false,
			dots: false,
			autoWidth: true,
			lazyLoad : true,
			autoPlay : 5000,
			stopOnHover : true
		});
	});
	
	//for toggle text in v.cat // A. Alfeev 19/07/17
	jQuery('.hidden-text-toggle').click(function(){
		neededDiv = jQuery(this).data('div');
		jQuery('#'+neededDiv).toggle(150);
		jQuery(this).text(function(i, text){
          return text === "Подробнее" ? "Скрыть" : "Подробнее";
      })
		return false;
	});
	
	



	//change paying amount
	function updateURLParameter(url, param, paramVal){
		var newAdditionalURL = "";
		var tempArray = url.split("?");
		var baseURL = tempArray[0];
		var additionalURL = tempArray[1];
		var temp = "";
		if (additionalURL) {
			tempArray = additionalURL.split("&");
			for (var i=0; i<tempArray.length; i++){
				if(tempArray[i].split('=')[0] != param){
					newAdditionalURL += temp + tempArray[i];
					temp = "&";
				}
			}
		}
		var rows_txt = temp + "" + param + "=" + paramVal;
		return baseURL + "?" + newAdditionalURL + rows_txt;
	}
	jQuery(".pay-order-amount").each(function(){
		jQuery(this).change(function(){
			amountLink = jQuery(this).next('.input-group-btn').find('.pay-order-link').attr('href');
			amountVal = jQuery(this).val();
			/*if (e.which != 8 && e.which != 0 && (e.which < 48 || e.which > 57)) {
				jQuery(this).val(amountVal.replace(e.key, ""));
				if(amountVal[0] == '0'){
					amountVal = amountVal.slice(1);
					jQuery(this).val(amountVal);
				}
			}
			else{
				if(amountVal[0] == '0'){
					amountVal = amountVal.slice(1);
					jQuery(this).val(amountVal);
				}
				jQuery(this).next('.input-group-btn').find('.pay-order-link').attr('href',updateURLParameter(amountLink,'amount',amountVal));
			}*/
			jQuery(this).next('.input-group-btn').find('.pay-order-link').attr('href',updateURLParameter(amountLink,'amount',amountVal));
		});
		jQuery(this).keyup(function(){
			jQuery(this).change();
		});
	});
	//END change paying amount
	
/*jQuery(window).load(function() {

 function elHeight(el){

 maxElHeight = 0;

 jQuery(el).each(function(){

 if(jQuery(this).height() > maxElHeight){

 maxElHeight = jQuery(this).height();

 }

 return (maxElHeight);

 });



 jQuery(el).each(function(){

 jQuery(this).height(maxElHeight);



 });

 }

 if(jQuery(window).width() > 768){

 elHeight('.item-title');

 }

 });*/

